<?php
$n_name = $_POST['n_name'];
$n_desc = $_POST['n_desc'];
$addTime = $_POST['addTime'];
$upTime = $_POST['upTime'];


$db = new PDO('mysql:host=localhost;dbname=test', 'root', 'root');

$sql = "insert into news( id, n_name, n_desc, addTime, upTime) value( null,$n_name, $n_desc, $addTime, $upTime)";

$res = $db -> query($sql);

if( $res )
{
   $arr['code'] = 0;
   $arr['msg'] = 'OK';
   $arr['data'] = ''; 
}else{
    $arr['code'] = 1;
    $arr['msg'] = '数据错误!!!';
    $arr['data'] = '';
}
    echo json_encode( $arr );  


?>